<?PHP
namespace DB // Persistence layer
{
   class DataBase
   {
      private static $repositories = array();

      /**
       * @param string $repositoryName
       * @return RepositoryInterface
       */
      public static function getRepository($repositoryName)
      {
         $name = self::$repositories[$repositoryName];
         $r = new \ReflectionClass($name);
         $inst = $r->newInstance();
         
         return $inst;
      }
      
      public static function registerRepository($name, $type)
      {
         self::$repositories[$name] = $type;
      }
   }
}